import React from 'react';
import ReservationForm from '../../components/ReservationForm/ReservationForm';
import { connect } from 'react-redux';
import { changePageState, submit, searched } from '../../actions/actions';

class Reservation extends React.Component {
    render() {
        return (
            <ReservationForm click={this.props.clickLeft} submit={this.props.searched.bind(this, true)}/>
        )
    }
}

const mapStateToProps = (state, ownProps = {}) => {
    return Object.assign(ownProps, {})
}

const mapDispatchToProps = (dispatch) => {
    return {
        clickLeft: () => {
            dispatch(changePageState({
                show: 'map'
            }));
        },
        submit: (data) => {
            dispatch(submit({
                filter: data
            }));
        },
        searched: (data) => {
            dispatch(searched({
                searched: data
            }));
        }
    }
}

export default connect(
    mapStateToProps,
    mapDispatchToProps
)(Reservation);
